home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 8 / QRZ Ham Radio Callsign Database - Volume 8.iso / mac / files / t_sys5 / 92052tar.gz / 920528.tar / ax25.h < prev    next >
C/C++ Source or Header  |  1992-01-13  |  4KB  |  130 lines

  1. /* @(#) $Header: ax25.h,v 1.8 92/01/12 18:39:53 deyke Exp $ */
  2.  
  3. #ifndef _AX25_H
  4. #define _AX25_H
  5.  
  6. #ifndef _GLOBAL_H
  7. #include "global.h"
  8. #endif
  9.  
  10. #ifndef _MBUF_H
  11. #include "mbuf.h"
  12. #endif
  13.  
  14. #ifndef _IFACE_H
  15. #include "iface.h"
  16. #endif
  17.  
  18. /* AX.25 datagram (address) sub-layer definitions */
  19.  
  20. #define MAXDIGIS        7       /* Maximum number of digipeaters */
  21. #define ALEN            6       /* Number of chars in callsign field */
  22. #define AXALEN          7       /* Total AX.25 address length, including SSID */
  23. #define AXBUF           10      /* Buffer size for maximum-length ascii call */
  24.  
  25. /* Bits within SSID field of AX.25 address */
  26. #define SSID            0x1e    /* Sub station ID */
  27. #define REPEATED        0x80    /* Has-been-repeated bit in repeater field */
  28. #define E               0x01    /* Address extension bit */
  29. #define C               0x80    /* Command/response designation */
  30.  
  31. /* Our AX.25 address */
  32. extern char Mycall[AXALEN];
  33.  
  34. /* List of AX.25 multicast addresses, e.g., "QST   -0" in shifted ASCII */
  35. extern char Ax25multi[][AXALEN];
  36.  
  37. extern int Digipeat;
  38.  
  39. /* Internal representation of an AX.25 header */
  40. struct ax25 {
  41.     char dest[AXALEN];              /* Destination address */
  42.     char source[AXALEN];            /* Source address */
  43.     char digis[MAXDIGIS][AXALEN];   /* Digi string */
  44.     int ndigis;                     /* Number of digipeaters */
  45.     int nextdigi;                   /* Index to next digi in chain */
  46.     int cmdrsp;                     /* Command/response */
  47. };
  48.  
  49. /* C-bit stuff */
  50. #define LAPB_UNKNOWN            0
  51. #define LAPB_COMMAND            1
  52. #define LAPB_RESPONSE           2
  53.  
  54. /* AX.25 routing table entry */
  55. struct ax_route {
  56.     char call[AXALEN];
  57.     struct ax_route *digi;
  58.     struct iface *ifp;
  59.     int perm;
  60.     long time;
  61.     struct ax_route *next;
  62. };
  63.  
  64. #define AXROUTESIZE     499
  65.  
  66. extern struct ax_route *Ax_routes[AXROUTESIZE];
  67. extern struct iface *axroute_default_ifp;
  68.  
  69. /* AX.25 Level 3 Protocol IDs (PIDs) */
  70. #define PID_X25         0x01    /* CCITT X.25 PLP */
  71. #define PID_SEGMENT     0x08    /* Segmentation fragment */
  72. #define PID_TEXNET      0xc3    /* TEXNET datagram protocol */
  73. #define PID_LQ          0xc4    /* Link quality protocol */
  74. #define PID_APPLETALK   0xca    /* Appletalk */
  75. #define PID_APPLEARP    0xcb    /* Appletalk ARP */
  76. #define PID_IP          0xcc    /* ARPA Internet Protocol */
  77. #define PID_ARP         0xcd    /* ARPA Address Resolution Protocol */
  78. #define PID_FLEXNET     0xce    /* FLEXNET */
  79. #define PID_NETROM      0xcf    /* NET/ROM */
  80. #define PID_NO_L3       0xf0    /* No level 3 protocol */
  81.  
  82. #define SEG_FIRST       0x80    /* First segment of a sequence */
  83. #define SEG_REM         0x7f    /* Mask for # segments remaining */
  84.  
  85. #define ismycall(call)   addreq(call, Mycall)
  86.  
  87. /* Linkage to network protocols atop ax25 */
  88. struct axlink {
  89.     int pid;
  90.     void (*funct) __ARGS((struct iface *,struct ax25_cb *,char *, char *,
  91.      struct mbuf *,int));
  92. };
  93. extern struct axlink Axlink[];
  94.  
  95. /* Codes for the open_ax call */
  96. #define AX_PASSIVE      0       /* not implemented */
  97. #define AX_ACTIVE       1
  98. #define AX_SERVER       2       /* Passive, clone on opening */
  99.  
  100. /* In ax25.c: */
  101. void ax_recv __ARGS((struct iface *,struct mbuf *));
  102. int ax_send __ARGS((struct mbuf *bp,struct iface *iface,int32 gateway,int prec,
  103.     int del,int tput,int rel));
  104. int ax_output __ARGS((struct iface *iface,char *dest,char *source,int pid,
  105.     struct mbuf *data));
  106. void axnl3 __ARGS((struct iface *iface,struct ax25_cb *axp,char *src,
  107.     char *dest,struct mbuf *bp,int mcast));
  108. struct ax_route *ax_routeptr __ARGS((char *call, int create));
  109. void axroute_add __ARGS((struct iface *iface, struct ax25 *hdr, int perm));
  110. void axroute __ARGS((struct ax25_cb *cp, struct mbuf *bp));
  111. char *ax25hdr_to_string __ARGS((struct ax25 *hdr));
  112.  
  113. /* In axhdr.c: */
  114. struct mbuf *htonax25 __ARGS((struct ax25 *hdr,struct mbuf *data));
  115. int ntohax25 __ARGS((struct ax25 *hdr,struct mbuf **bpp));
  116.  
  117. /* In ax25subr.c: */
  118. int addreq __ARGS((char *a,char *b));
  119. struct iface *ismyax25addr __ARGS((char *addr));
  120. void addrcp __ARGS((char *to,char *from));
  121. char *pax25 __ARGS((char *e,char *addr));
  122. int setcall __ARGS((char *out,char *call));
  123. int16 ftype __ARGS((int control));
  124.  
  125. /* In ax25file.c: */
  126. void axroute_savefile __ARGS((void));
  127. void axroute_loadfile __ARGS((void));
  128.  
  129. #endif  /* _AX25_H */
  130.